Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If ASK_PASSWORD Recovery Scenario, Update Thread Local Properties Specifying the Flow is Password Set #823

Closed
wants to merge 5 commits into from

Conversation

dhaura
Copy link
Contributor

@dhaura dhaura commented May 31, 2024

Proposed changes in this pull request

  • $Subject

When should this PR be merged

Comment on lines +940 to +943
if (RecoveryScenarios.ASK_PASSWORD.equals(recoveryScenario)) {
IdentityUtil.threadLocalProperties.get().put(AccountConstants.PASSWORD_SET_FLOW, true);
} else {
IdentityUtil.threadLocalProperties.get().put(AccountConstants.PASSWORD_SET_FLOW, false);
Copy link
Contributor

@AnuradhaSK AnuradhaSK Jun 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't see any place where clearing the threadlocal properties. (If using thread local need to clear them at a proper place)
Since threadlocal usage is bit unsafe can we go with adding a runtime claim to userClaims list and get it should in the account lock handler?
I hope we can go with a runtime claim which is not actually registered into the claims of the tenant.

Copy link
Contributor Author

@dhaura dhaura Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since user claims are not passed from governance to account lock handler event, it is not possible to add a temporary runtime claim from here. Therefore, the runtime claim should have to be updated and read through the userstore manager. Since this PASSWORD_SET_FLOW relates to a specific user flow (and not the user), if such a user claim is used, another flow (ex: password reset flow) might incorrectly read the said user claim. Therefore, it seems like thread local property solution is the on way to achieve this objective.

Furthermore, the clearance of the introduced thread local property is addressed by 0757aa6, de1c7a9 and 66219ce.

@dhaura dhaura marked this pull request as ready for review June 3, 2024 11:25
@dhaura
Copy link
Contributor Author

dhaura commented Jun 6, 2024

The implementation changed and the new implementation can be found with wso2-extensions/identity-event-handler-account-lock#139

@dhaura dhaura closed this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants